package com.qf.bill;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayDataDataserviceBillDownloadurlQueryRequest;
import com.alipay.api.response.AlipayDataDataserviceBillDownloadurlQueryResponse;
import com.qf.mch.MchConfig;

public class BillTest {
    public static void main(String[] args) throws AlipayApiException {
        AlipayClient alipayClient = new DefaultAlipayClient(MchConfig.serverurl, MchConfig.appid, MchConfig.privatekey, "json", "UTF-8", MchConfig.publickey, "RSA2");

        AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
        JSONObject bizContent = new JSONObject();
        bizContent.put("bill_type", "trade");
        bizContent.put("bill_date", "2023-09-24");
        request.setBizContent(bizContent.toJSONString());
        AlipayDataDataserviceBillDownloadurlQueryResponse response = alipayClient.execute(request);

        System.out.println(response.getBillDownloadUrl());
        System.out.println(JSON.toJSONString(response));

    }
}
